package com.tedu._04mybatis.mapper;

import com.tedu._04mybatis.pojo.Comment;
import com.tedu._04mybatis.pojo.CommentVO1;
import com.tedu._04mybatis.pojo.CommentVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface CommentMapper {
    //@Insert("INSERT INTO comment(content,created,user_id,weibo_id) VALUES (#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);

    //@Delete("DELETE FROM comment WHERE id=#{id}")
    int deleteComment(Integer id);

    //@Update("UPDATE comment SET content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} WHERE id=#{id}")
    int updateComment(Comment comment);

    //@Select("SELECT id,content,created,user_id userId,weibo_id weiboId FROM comment WHERE  id= #{id}")
    Comment selectCommentId(Integer id);

    //@Select("SELECT content,user_id userId FROM comment WHERE weibo_id=#{weiboId}")
    CommentVO1 selectCommentVO1Id(Integer weiboId);

    //@Select("SELECT content,user_id userId,weibo_id weiboId FROM comment WHERE id= #{id}")
    CommentVO2 selectCommentVO2Id(Integer id);

    int dynamicUpdateComment(Comment comment);
    int dynamicDeleteComment(Integer[] ids);
    int dynamicDeleteComment2(List<Integer> ids);

}
